<% if can? :create, Topic %>
  <% cache(["sidebar_new_topic_box",SiteConfig.new_topic_dropdown_node_ids]) do %>
    <div class="panel panel-default clearfix">
      <div class="panel-body">
        <div class="btn-group pull-left">
          <%= link_to(t("topics.start_a_new_topic_button"), new_topic_path, class: "btn btn-primary" )%>
          <button class="btn btn-primary dropdown-toggle" data-toggle="dropdown">
            <span class="caret"></span>
          </button>
          <ul class="dropdown-menu">
            <% Node.new_topic_dropdowns.each do |node| %>
              <li>
                <%= link_to(node.name, new_topic_path(node: node.id)) %>
              </li>
            <% end %>
          </ul>
        </div>

        <%= link_to(sanitize("<span class='icon icons-rss'></span> RSS"), feed_topics_url, title: t("topics.subscribe_with_rss", name: Setting.app_name), class: "pull-right feed-button btn btn-default", target: "_blank") %>
      </div>
    </div>
  <% end %>
<% end %>

<% if current_user && current_user.newbie? %>
<div class="panel panel-default">
  <div class="panel-heading">新手必读</div>
  <div class="panel-body">
    <%= raw SiteConfig.newbie_notices %>
  </div>
</div>
<% end %>

<%= render "topics/sidebar_box_tips" %>

<%= raw SiteConfig.topic_index_sidebar_html %>

<% cache(["sidebar_statistics",Time.now.strftime("%Y-%m-%d %H")]) do %>
<div class="panel panel-default">
  <div class="panel-heading"><%= t("common.statics")%></div>
  <ul class="list-group">
    <li class="list-group-item">社区会员: <%= User.unscoped.count %> 人</li>
    <li class="list-group-item">帖子数: <%= Topic.unscoped.count %> 个</li>
    <li class="list-group-item">回帖数: <%= Reply.unscoped.count %> 条</li>
  </ul>
</div>
<% end %>
